package com.fenxiangle.yueding.feature.focus.view.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fenxiangle.yueding.R;
import com.fenxiangle.yueding.common.util.DateTool;
import com.fenxiangle.yueding.entity.VedioType;
import com.fenxiangle.yueding.entity.bo.FoucsListBo;
import com.suozhang.framework.framework.AM;
import com.suozhang.framework.utils.DateUtil;

public class FocusAdapter extends BaseQuickAdapter<FoucsListBo, BaseViewHolder> {
    public FocusAdapter() {
        super(R.layout.item_focus);
    }

    @Override
    protected void convert(BaseViewHolder helper, FoucsListBo item) {
        helper.setText(R.id.iv_foucs_name, item.getUserName())
                .setText(R.id.iv_foucs_date, DateTool.formatTime(item.getVideo_createTime()))
                .setText(R.id.iv_foucs_score, "信用分：" + item.getCreditScore() + "\t\t\t时间值：￥" + item.getTimeValue()+"/小时")
                .setText(R.id.iv_foucs_title, VedioType.getName(item.getVideoType()))
                .setVisible(R.id.iv_foucs_title,!TextUtils.isEmpty(item.getVideoUrl()))
                .addOnClickListener(R.id.iv_fouce_cover)
                .addOnClickListener(R.id.iv_foucs_count)
                .addOnClickListener(R.id.iv_foucs_head)
        ;
        AM.image().bindToCircleObject(item.getUserHead(), helper.getView(R.id.iv_foucs_head));
        AM.image().bind(!TextUtils.isEmpty(item.getVideoCover())&&!TextUtils.isEmpty(item.getVideoUrl())?item.getVideoCover():item.getImage(), helper.getView(R.id.iv_fouce_cover));
    }
}
